package cn.kk.fluidcells.cells.keyboard;

import java.awt.Toolkit;

public enum KeyCode {
    VK_ENTER('\n'),
    VK_BACK_SPACE('\b'),
    VK_TAB('\t'),
    VK_CANCEL(0x03),

    VK_SHIFT(0x10),
    VK_CONTROL(0x11),
    VK_ALT(0x12),

    /** Constant for the Meta or Command key. */
    VK_META(0x9D),

    /** Constant for the Microsoft Windows key. */
    VK_WINDOWS(0x020C),

    /** Constant for the Microsoft Windows Context Menu key. */
    VK_CONTEXT_MENU(0x020D),

    VK_PAUSE(0x13),
    VK_CAPS_LOCK(0x14),
    VK_ESCAPE(0x1B),
    VK_SPACE(0x20),

    VK_UP(0x26),
    VK_DOWN(0x28),
    VK_LEFT(0x25),
    VK_RIGHT(0x27),

    VK_COMMA(0x2C),
    VK_MINUS(0x2D),
    VK_PERIOD(0x2E),
    VK_SLASH(0x2F),

    /** VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39). */
    VK_0(0x30),
    VK_1(0x31),
    VK_2(0x32),
    VK_3(0x33),
    VK_4(0x34),
    VK_5(0x35),
    VK_6(0x36),
    VK_7(0x37),
    VK_8(0x38),
    VK_9(0x39),

    VK_EQUALS(0x3D),
    VK_SEMICOLON(0x3B),

    /** VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A). */
    VK_A(0x41),
    VK_B(0x42),
    VK_C(0x43),
    VK_D(0x44),
    VK_E(0x45),
    VK_F(0x46),
    VK_G(0x47),
    VK_H(0x48),
    VK_I(0x49),
    VK_J(0x4A),
    VK_K(0x4B),
    VK_L(0x4C),
    VK_M(0x4D),
    VK_N(0x4E),
    VK_O(0x4F),
    VK_P(0x50),
    VK_Q(0x51),
    VK_R(0x52),
    VK_S(0x53),
    VK_T(0x54),
    VK_U(0x55),
    VK_V(0x56),
    VK_W(0x57),
    VK_X(0x58),
    VK_Y(0x59),
    VK_Z(0x5A),

    VK_OPEN_BRACKET(0x5B),
    VK_BACK_SLASH(0x5C),
    VK_CLOSE_BRACKET(0x5D),

    VK_NUMPAD0(0x60),
    VK_NUMPAD1(0x61),
    VK_NUMPAD2(0x62),
    VK_NUMPAD3(0x63),
    VK_NUMPAD4(0x64),
    VK_NUMPAD5(0x65),
    VK_NUMPAD6(0x66),
    VK_NUMPAD7(0x67),
    VK_NUMPAD8(0x68),
    VK_NUMPAD9(0x69),

    VK_KP_UP(0xE0),
    VK_KP_DOWN(0xE1),
    VK_KP_LEFT(0xE2),
    VK_KP_RIGHT(0xE3),

    VK_MULTIPLY(0x6A),
    VK_ADD(0x6B),
    VK_SUBTRACT(0x6D),
    VK_DECIMAL(0x6E),
    VK_DIVIDE(0x6F),
    VK_DELETE(0x7F),
    VK_CLEAR(0x03),
    VK_NUM_LOCK(0x90),
    VK_SCROLL_LOCK(0x91),

    /** Constants for the F1 through F24 function keys. */
    VK_F1(0x70),
    VK_F2(0x71),
    VK_F3(0x72),
    VK_F4(0x73),
    VK_F5(0x74),
    VK_F6(0x75),
    VK_F7(0x76),
    VK_F8(0x77),
    VK_F9(0x78),
    VK_F10(0x79),
    VK_F11(0x7A),
    VK_F12(0x7B),

    VK_F13(0xF000),
    VK_F14(0xF001),
    VK_F15(0xF002),
    VK_F16(0xF003),
    VK_F17(0xF004),
    VK_F18(0xF005),
    VK_F19(0xF006),
    VK_F20(0xF007),
    VK_F21(0xF008),
    VK_F22(0xF009),
    VK_F23(0xF00A),
    VK_F24(0xF00B),

    VK_PRINTSCREEN(0x9A),
    VK_INSERT(0x9B),
    VK_HELP(0x9C),

    VK_PAGE_UP(0x21),
    VK_PAGE_DOWN(0x22),
    VK_HOME(0x24),
    VK_END(0x23),

    VK_QUOTE(0xDE),
    VK_BACK_QUOTE(0xC0),

    /* For European keyboards */
    VK_DEAD_GRAVE(0x80),
    VK_DEAD_ACUTE(0x81),
    VK_DEAD_CIRCUMFLEX(0x82),
    VK_DEAD_TILDE(0x83),
    VK_DEAD_MACRON(0x84),
    VK_DEAD_BREVE(0x85),
    VK_DEAD_ABOVEDOT(0x86),
    VK_DEAD_DIAERESIS(0x87),
    VK_DEAD_ABOVERING(0x88),
    VK_DEAD_DOUBLEACUTE(0x89),
    VK_DEAD_CARON(0x8A),
    VK_DEAD_CEDILLA(0x8B),
    VK_DEAD_OGONEK(0x8C),
    VK_DEAD_IOTA(0x8D),
    VK_DEAD_VOICED_SOUND(0x8E),
    VK_DEAD_SEMIVOICED_SOUND(0x8F),

    /* Unknown Keyboard Codes */
    VK_AMPERSAND(0x96),
    VK_ASTERISK(0x97),
    VK_QUOTEDBL(0x98),
    VK_LESS(0x99),
    VK_GREATER(0xA0),
    VK_BRACELEFT(0xA1),
    VK_BRACERIGHT(0xA2),

    /* Unknown Extended Keyboard Codes */
    VK_AT(0x0200),
    VK_COLON(0x0201),
    VK_CIRCUMFLEX(0x0202),
    VK_DOLLAR(0x0203),
    VK_EURO_SIGN(0x0204),
    VK_EXCLAMATION_MARK(0x0205),
    VK_INVERTED_EXCLAMATION_MARK(0x0206),
    VK_LEFT_PARENTHESIS(0x0207),
    VK_NUMBER_SIGN(0x0208),
    VK_PLUS(0x0209),
    VK_RIGHT_PARENTHESIS(0x020A),
    VK_UNDERSCORE(0x020B),

    /* For input method support on Asian Keyboards */
    VK_FINAL(0x0018),
    VK_CONVERT(0x001C),
    VK_NONCONVERT(0x001D),
    VK_ACCEPT(0x001E),
    VK_MODECHANGE(0x001F),
    VK_KANA(0x0015),
    VK_KANJI(0x0019),
    VK_ALPHANUMERIC(0x00F0),
    VK_KATAKANA(0x00F1),
    VK_HIRAGANA(0x00F2),
    VK_FULL_WIDTH(0x00F3),
    VK_HALF_WIDTH(0x00F4),
    VK_ROMAN_CHARACTERS(0x00F5),
    VK_ALL_CANDIDATES(0x0100),
    VK_PREVIOUS_CANDIDATE(0x0101),
    VK_CODE_INPUT(0x0102),
    VK_JAPANESE_KATAKANA(0x0103),
    VK_JAPANESE_HIRAGANA(0x0104),
    VK_JAPANESE_ROMAN(0x0105),
    VK_KANA_LOCK(0x0106),
    VK_INPUT_METHOD_ON_OFF(0x0107),

    /* For Sun keyboards */
    VK_CUT(0xFFD1),
    VK_COPY(0xFFCD),
    VK_PASTE(0xFFCF),
    VK_UNDO(0xFFCB),
    VK_AGAIN(0xFFC9),
    VK_FIND(0xFFD0),
    VK_PROPS(0xFFCA),
    VK_STOP(0xFFC8),
    VK_COMPOSE(0xFF20),
    VK_ALT_GRAPH(0xFF7E),

    VK_BEGIN(0xFF58),

    VK_FN(0xFF),

    /** This value is used to indicate that the keyCode is unknown. */
    VK_UNDEFINED(0x00), ;
    public final int keyCode;
    private String keyText;

    KeyCode(final int keyCode) {
        this.keyCode = keyCode;
    }

    public final String getKeyText() {
        return KeyCode.getKeyText(this);
    }

    public static final String getKeyText(KeyCode kc) {
        if (kc.keyText == null) {
            int kCode = kc.keyCode;

            switch (kc) {
                case VK_A:
                case VK_B:
                case VK_C:
                case VK_D:
                case VK_E:
                case VK_F:
                case VK_G:
                case VK_H:
                case VK_I:
                case VK_J:
                case VK_K:
                case VK_L:
                case VK_M:
                case VK_N:
                case VK_O:
                case VK_P:
                case VK_Q:
                case VK_R:
                case VK_S:
                case VK_T:
                case VK_U:
                case VK_V:
                case VK_W:
                case VK_X:
                case VK_Y:
                case VK_Z:
                    kc.keyText = String.valueOf((char) kCode);
                    break;
                case VK_NUMPAD0:
                case VK_NUMPAD1:
                case VK_NUMPAD2:
                case VK_NUMPAD3:
                case VK_NUMPAD4:
                case VK_NUMPAD5:
                case VK_NUMPAD6:
                case VK_NUMPAD7:
                case VK_NUMPAD8:
                case VK_NUMPAD9:
                    kCode -= VK_NUMPAD0.keyCode - VK_0.keyCode;
                case VK_0:
                case VK_1:
                case VK_2:
                case VK_3:
                case VK_4:
                case VK_5:
                case VK_6:
                case VK_7:
                case VK_8:
                case VK_9:
                    kc.keyText = String.valueOf((char) kCode);
                    break;
                case VK_FN:
                    kc.keyText = "Fn";
                    break;
                case VK_ENTER:
                    kc.keyText = Toolkit.getProperty("AWT.enter", "Enter");
                    break;
                case VK_BACK_SPACE:
                    kc.keyText = Toolkit.getProperty("AWT.backSpace", "Backspace");
                    break;
                case VK_TAB:
                    kc.keyText = Toolkit.getProperty("AWT.tab", "Tab");
                    break;
                case VK_SHIFT:
                    kc.keyText = Toolkit.getProperty("AWT.shift", "Shift");
                    break;
                case VK_CONTROL:
                    kc.keyText = Toolkit.getProperty("AWT.control", "Control");
                    break;
                case VK_ALT:
                    kc.keyText = Toolkit.getProperty("AWT.alt", "Alt");
                    break;
                case VK_META:
                    kc.keyText = Toolkit.getProperty("AWT.meta", "Meta");
                    break;
                case VK_WINDOWS:
                    kc.keyText = Toolkit.getProperty("AWT.windows", "Windows");
                    break;
                case VK_CONTEXT_MENU:
                    kc.keyText = Toolkit.getProperty("AWT.context", "Context Menu");
                    break;
                case VK_PAUSE:
                    kc.keyText = Toolkit.getProperty("AWT.pause", "Pause");
                    break;
                case VK_CAPS_LOCK:
                    kc.keyText = Toolkit.getProperty("AWT.capsLock", "Caps Lock");
                    break;
                case VK_ESCAPE:
                    kc.keyText = Toolkit.getProperty("AWT.escape", "Escape");
                    break;
                case VK_SPACE:
                    kc.keyText = Toolkit.getProperty("AWT.space", "Space");
                    break;
                case VK_UP:
                    kc.keyText = Toolkit.getProperty("AWT.up", "Up");
                    break;
                case VK_DOWN:
                    kc.keyText = Toolkit.getProperty("AWT.down", "Down");
                    break;
                case VK_LEFT:
                    kc.keyText = Toolkit.getProperty("AWT.left", "Left");
                    break;
                case VK_RIGHT:
                    kc.keyText = Toolkit.getProperty("AWT.right", "Right");
                    break;
                case VK_COMMA:
                    kc.keyText = Toolkit.getProperty("AWT.comma", "Comma");
                    break;
                case VK_MINUS:
                    kc.keyText = Toolkit.getProperty("AWT.minus", "Minus");
                    break;
                case VK_PERIOD:
                    kc.keyText = Toolkit.getProperty("AWT.period", "Period");
                    break;
                case VK_SLASH:
                    kc.keyText = Toolkit.getProperty("AWT.slash", "Slash");
                    break;
                case VK_EQUALS:
                    kc.keyText = Toolkit.getProperty("AWT.equals", "Equals");
                    break;
                case VK_SEMICOLON:
                    kc.keyText = Toolkit.getProperty("AWT.semicolon", "Semicolon");
                    break;
                case VK_OPEN_BRACKET:
                    kc.keyText = Toolkit.getProperty("AWT.openBracket", "Open Bracket");
                    break;
                case VK_BACK_SLASH:
                    kc.keyText = Toolkit.getProperty("AWT.backSlash", "Back Slash");
                    break;
                case VK_CLOSE_BRACKET:
                    kc.keyText = Toolkit.getProperty("AWT.closeBracket", "Close Bracket");
                    break;
                case VK_KP_UP:
                    kc.keyText = Toolkit.getProperty("AWT.up", "Up");
                    break;
                case VK_KP_DOWN:
                    kc.keyText = Toolkit.getProperty("AWT.down", "Down");
                    break;
                case VK_KP_LEFT:
                    kc.keyText = Toolkit.getProperty("AWT.left", "Left");
                    break;
                case VK_KP_RIGHT:
                    kc.keyText = Toolkit.getProperty("AWT.right", "Right");
                    break;
                case VK_MULTIPLY:
                    kc.keyText = Toolkit.getProperty("AWT.multiply", "NumPad *");
                    break;
                case VK_ADD:
                    kc.keyText = Toolkit.getProperty("AWT.add", "NumPad +");
                    break;
                case VK_SUBTRACT:
                    kc.keyText = Toolkit.getProperty("AWT.subtract", "NumPad -");
                    break;
                case VK_DECIMAL:
                    kc.keyText = Toolkit.getProperty("AWT.decimal", "NumPad .");
                    break;
                case VK_DIVIDE:
                    kc.keyText = Toolkit.getProperty("AWT.divide", "NumPad /");
                    break;
                case VK_DELETE:
                    kc.keyText = Toolkit.getProperty("AWT.delete", "Delete");
                    break;
                case VK_NUM_LOCK:
                    kc.keyText = Toolkit.getProperty("AWT.numLock", "Num Lock");
                    break;
                case VK_CLEAR:
                    kc.keyText = Toolkit.getProperty("AWT.clear", "Clear");
                    break;
                case VK_SCROLL_LOCK:
                    kc.keyText = Toolkit.getProperty("AWT.scrollLock", "Scroll Lock");
                    break;
                case VK_F1:
                    kc.keyText = Toolkit.getProperty("AWT.f1", "F1");
                    break;
                case VK_F2:
                    kc.keyText = Toolkit.getProperty("AWT.f2", "F2");
                    break;
                case VK_F3:
                    kc.keyText = Toolkit.getProperty("AWT.f3", "F3");
                    break;
                case VK_F4:
                    kc.keyText = Toolkit.getProperty("AWT.f4", "F4");
                    break;
                case VK_F5:
                    kc.keyText = Toolkit.getProperty("AWT.f5", "F5");
                    break;
                case VK_F6:
                    kc.keyText = Toolkit.getProperty("AWT.f6", "F6");
                    break;
                case VK_F7:
                    kc.keyText = Toolkit.getProperty("AWT.f7", "F7");
                    break;
                case VK_F8:
                    kc.keyText = Toolkit.getProperty("AWT.f8", "F8");
                    break;
                case VK_F9:
                    kc.keyText = Toolkit.getProperty("AWT.f9", "F9");
                    break;
                case VK_F10:
                    kc.keyText = Toolkit.getProperty("AWT.f10", "F10");
                    break;
                case VK_F11:
                    kc.keyText = Toolkit.getProperty("AWT.f11", "F11");
                    break;
                case VK_F12:
                    kc.keyText = Toolkit.getProperty("AWT.f12", "F12");
                    break;
                case VK_F13:
                    kc.keyText = Toolkit.getProperty("AWT.f13", "F13");
                    break;
                case VK_F14:
                    kc.keyText = Toolkit.getProperty("AWT.f14", "F14");
                    break;
                case VK_F15:
                    kc.keyText = Toolkit.getProperty("AWT.f15", "F15");
                    break;
                case VK_F16:
                    kc.keyText = Toolkit.getProperty("AWT.f16", "F16");
                    break;
                case VK_F17:
                    kc.keyText = Toolkit.getProperty("AWT.f17", "F17");
                    break;
                case VK_F18:
                    kc.keyText = Toolkit.getProperty("AWT.f18", "F18");
                    break;
                case VK_F19:
                    kc.keyText = Toolkit.getProperty("AWT.f19", "F19");
                    break;
                case VK_F20:
                    kc.keyText = Toolkit.getProperty("AWT.f20", "F20");
                    break;
                case VK_F21:
                    kc.keyText = Toolkit.getProperty("AWT.f21", "F21");
                    break;
                case VK_F22:
                    kc.keyText = Toolkit.getProperty("AWT.f22", "F22");
                    break;
                case VK_F23:
                    kc.keyText = Toolkit.getProperty("AWT.f23", "F23");
                    break;
                case VK_F24:
                    kc.keyText = Toolkit.getProperty("AWT.f24", "F24");
                    break;
                case VK_PRINTSCREEN:
                    kc.keyText = Toolkit.getProperty("AWT.printScreen", "Print Screen");
                    break;
                case VK_INSERT:
                    kc.keyText = Toolkit.getProperty("AWT.insert", "Insert");
                    break;
                case VK_HELP:
                    kc.keyText = Toolkit.getProperty("AWT.help", "Help");
                    break;
                case VK_PAGE_UP:
                    kc.keyText = Toolkit.getProperty("AWT.pgup", "Page Up");
                    break;
                case VK_PAGE_DOWN:
                    kc.keyText = Toolkit.getProperty("AWT.pgdn", "Page Down");
                    break;
                case VK_HOME:
                    kc.keyText = Toolkit.getProperty("AWT.home", "Home");
                    break;
                case VK_END:
                    kc.keyText = Toolkit.getProperty("AWT.end", "End");
                    break;
                case VK_QUOTE:
                    kc.keyText = Toolkit.getProperty("AWT.quote", "Quote");
                    break;
                case VK_BACK_QUOTE:
                    kc.keyText = Toolkit.getProperty("AWT.backQuote", "Back Quote");
                    break;
                case VK_DEAD_GRAVE:
                    kc.keyText = Toolkit.getProperty("AWT.deadGrave", "Dead Grave");
                    break;
                case VK_DEAD_ACUTE:
                    kc.keyText = Toolkit.getProperty("AWT.deadAcute", "Dead Acute");
                    break;
                case VK_DEAD_CIRCUMFLEX:
                    kc.keyText = Toolkit.getProperty("AWT.deadCircumflex", "Dead Circumflex");
                    break;
                case VK_DEAD_TILDE:
                    kc.keyText = Toolkit.getProperty("AWT.deadTilde", "Dead Tilde");
                    break;
                case VK_DEAD_MACRON:
                    kc.keyText = Toolkit.getProperty("AWT.deadMacron", "Dead Macron");
                    break;
                case VK_DEAD_BREVE:
                    kc.keyText = Toolkit.getProperty("AWT.deadBreve", "Dead Breve");
                    break;
                case VK_DEAD_ABOVEDOT:
                    kc.keyText = Toolkit.getProperty("AWT.deadAboveDot", "Dead Above Dot");
                    break;
                case VK_DEAD_DIAERESIS:
                    kc.keyText = Toolkit.getProperty("AWT.deadDiaeresis", "Dead Diaeresis");
                    break;
                case VK_DEAD_ABOVERING:
                    kc.keyText = Toolkit.getProperty("AWT.deadAboveRing", "Dead Above Ring");
                    break;
                case VK_DEAD_DOUBLEACUTE:
                    kc.keyText = Toolkit.getProperty("AWT.deadDoubleAcute", "Dead Double Acute");
                    break;
                case VK_DEAD_CARON:
                    kc.keyText = Toolkit.getProperty("AWT.deadCaron", "Dead Caron");
                    break;
                case VK_DEAD_CEDILLA:
                    kc.keyText = Toolkit.getProperty("AWT.deadCedilla", "Dead Cedilla");
                    break;
                case VK_DEAD_OGONEK:
                    kc.keyText = Toolkit.getProperty("AWT.deadOgonek", "Dead Ogonek");
                    break;
                case VK_DEAD_IOTA:
                    kc.keyText = Toolkit.getProperty("AWT.deadIota", "Dead Iota");
                    break;
                case VK_DEAD_VOICED_SOUND:
                    kc.keyText = Toolkit.getProperty("AWT.deadVoicedSound", "Dead Voiced Sound");
                    break;
                case VK_DEAD_SEMIVOICED_SOUND:
                    kc.keyText = Toolkit.getProperty("AWT.deadSemivoicedSound", "Dead Semivoiced Sound");
                    break;
                case VK_AMPERSAND:
                    kc.keyText = Toolkit.getProperty("AWT.ampersand", "Ampersand");
                    break;
                case VK_ASTERISK:
                    kc.keyText = Toolkit.getProperty("AWT.asterisk", "Asterisk");
                    break;
                case VK_QUOTEDBL:
                    kc.keyText = Toolkit.getProperty("AWT.quoteDbl", "Double Quote");
                    break;
                case VK_LESS:
                    kc.keyText = Toolkit.getProperty("AWT.less", "Less");
                    break;
                case VK_GREATER:
                    kc.keyText = Toolkit.getProperty("AWT.greater", "Greater");
                    break;
                case VK_BRACELEFT:
                    kc.keyText = Toolkit.getProperty("AWT.braceLeft", "Left Brace");
                    break;
                case VK_BRACERIGHT:
                    kc.keyText = Toolkit.getProperty("AWT.braceRight", "Right Brace");
                    break;
                case VK_AT:
                    kc.keyText = Toolkit.getProperty("AWT.at", "At");
                    break;
                case VK_COLON:
                    kc.keyText = Toolkit.getProperty("AWT.colon", "Colon");
                    break;
                case VK_CIRCUMFLEX:
                    kc.keyText = Toolkit.getProperty("AWT.circumflex", "Circumflex");
                    break;
                case VK_DOLLAR:
                    kc.keyText = Toolkit.getProperty("AWT.dollar", "Dollar");
                    break;
                case VK_EURO_SIGN:
                    kc.keyText = Toolkit.getProperty("AWT.euro", "Euro");
                    break;
                case VK_EXCLAMATION_MARK:
                    kc.keyText = Toolkit.getProperty("AWT.exclamationMark", "Exclamation Mark");
                    break;
                case VK_INVERTED_EXCLAMATION_MARK:
                    kc.keyText = Toolkit.getProperty("AWT.invertedExclamationMark", "Inverted Exclamation Mark");
                    break;
                case VK_LEFT_PARENTHESIS:
                    kc.keyText = Toolkit.getProperty("AWT.leftParenthesis", "Left Parenthesis");
                    break;
                case VK_NUMBER_SIGN:
                    kc.keyText = Toolkit.getProperty("AWT.numberSign", "Number Sign");
                    break;
                case VK_PLUS:
                    kc.keyText = Toolkit.getProperty("AWT.plus", "Plus");
                    break;
                case VK_RIGHT_PARENTHESIS:
                    kc.keyText = Toolkit.getProperty("AWT.rightParenthesis", "Right Parenthesis");
                    break;
                case VK_UNDERSCORE:
                    kc.keyText = Toolkit.getProperty("AWT.underscore", "Underscore");
                    break;
                case VK_FINAL:
                    kc.keyText = Toolkit.getProperty("AWT.quote", "Quote");
                    break;
                case VK_CONVERT:
                    kc.keyText = Toolkit.getProperty("AWT.convert", "Convert");
                    break;
                case VK_NONCONVERT:
                    kc.keyText = Toolkit.getProperty("AWT.noconvert", "No Convert");
                    break;
                case VK_ACCEPT:
                    kc.keyText = Toolkit.getProperty("AWT.accept", "Accept");
                    break;
                case VK_MODECHANGE:
                    kc.keyText = Toolkit.getProperty("AWT.modechange", "Mode Change");
                    break;
                case VK_KANA:
                    kc.keyText = Toolkit.getProperty("AWT.kana", "Kana");
                    break;
                case VK_KANJI:
                    kc.keyText = Toolkit.getProperty("AWT.kanji", "Kanji");
                    break;
                case VK_ALPHANUMERIC:
                    kc.keyText = Toolkit.getProperty("AWT.alphanumeric", "Alphanumeric");
                    break;
                case VK_KATAKANA:
                    kc.keyText = Toolkit.getProperty("AWT.katakana", "Katakana");
                    break;
                case VK_HIRAGANA:
                    kc.keyText = Toolkit.getProperty("AWT.hiragana", "Hiragana");
                    break;
                case VK_FULL_WIDTH:
                    kc.keyText = Toolkit.getProperty("AWT.fullWidth", "Full-Width");
                    break;
                case VK_HALF_WIDTH:
                    kc.keyText = Toolkit.getProperty("AWT.halfWidth", "Half-Width");
                    break;
                case VK_ROMAN_CHARACTERS:
                    kc.keyText = Toolkit.getProperty("AWT.romanCharacters", "Roman Characters");
                    break;
                case VK_ALL_CANDIDATES:
                    kc.keyText = Toolkit.getProperty("AWT.allCandidates", "All Candidates");
                    break;
                case VK_PREVIOUS_CANDIDATE:
                    kc.keyText = Toolkit.getProperty("AWT.previousCandidate", "Previous Candidate");
                    break;
                case VK_CODE_INPUT:
                    kc.keyText = Toolkit.getProperty("AWT.codeInput", "Code Input");
                    break;
                case VK_JAPANESE_KATAKANA:
                    kc.keyText = Toolkit.getProperty("AWT.japaneseKatakana", "Japanese Katakana");
                    break;
                case VK_JAPANESE_HIRAGANA:
                    kc.keyText = Toolkit.getProperty("AWT.japaneseHiragana", "Japanese Hiragana");
                    break;
                case VK_JAPANESE_ROMAN:
                    kc.keyText = Toolkit.getProperty("AWT.japaneseRoman", "Japanese Roman");
                    break;
                case VK_KANA_LOCK:
                    kc.keyText = Toolkit.getProperty("AWT.kanaLock", "Kana Lock");
                    break;
                case VK_INPUT_METHOD_ON_OFF:
                    kc.keyText = Toolkit.getProperty("AWT.inputMethodOnOff", "Input Method On/Off");
                    break;
                case VK_AGAIN:
                    kc.keyText = Toolkit.getProperty("AWT.again", "Again");
                    break;
                case VK_UNDO:
                    kc.keyText = Toolkit.getProperty("AWT.undo", "Undo");
                    break;
                case VK_COPY:
                    kc.keyText = Toolkit.getProperty("AWT.copy", "Copy");
                    break;
                case VK_PASTE:
                    kc.keyText = Toolkit.getProperty("AWT.paste", "Paste");
                    break;
                case VK_CUT:
                    kc.keyText = Toolkit.getProperty("AWT.cut", "Cut");
                    break;
                case VK_FIND:
                    kc.keyText = Toolkit.getProperty("AWT.find", "Find");
                    break;
                case VK_PROPS:
                    kc.keyText = Toolkit.getProperty("AWT.props", "Props");
                    break;
                case VK_STOP:
                    kc.keyText = Toolkit.getProperty("AWT.stop", "Stop");
                    break;
                case VK_BEGIN:
                    kc.keyText = Toolkit.getProperty("AWT.begin", "Begin");
                    break;
                case VK_UNDEFINED:
                    kc.keyText = Toolkit.getProperty("AWT.undefined", "Undefined");
                    break;
                default:
                    kc.keyText = Toolkit.getProperty("AWT.unknown", "Unknown") + " keyCode: 0x"
                            + Integer.toString(kCode, 16);
            }
        }
        return kc.keyText;
    }

    public final boolean isActionKey() {
        return KeyCode.isActionKey(this);
    }

    public static final boolean isActionKey(KeyCode kc) {
        switch (kc) {
            case VK_SHIFT:
            case VK_CONTROL:
            case VK_ALT:
            case VK_META:
            case VK_WINDOWS:
            case VK_CONTEXT_MENU:

            case VK_UP:
            case VK_DOWN:
            case VK_LEFT:
            case VK_RIGHT:

            case VK_F1:
            case VK_F2:
            case VK_F3:
            case VK_F4:
            case VK_F5:
            case VK_F6:
            case VK_F7:
            case VK_F8:
            case VK_F9:
            case VK_F10:
            case VK_F11:
            case VK_F12:

            case VK_F13:
            case VK_F14:
            case VK_F15:
            case VK_F16:
            case VK_F17:
            case VK_F18:
            case VK_F19:
            case VK_F20:
            case VK_F21:
            case VK_F22:
            case VK_F23:
            case VK_F24:

            case VK_PRINTSCREEN:
            case VK_INSERT:
            case VK_HELP:

            case VK_PAGE_UP:
            case VK_PAGE_DOWN:
            case VK_HOME:
            case VK_END:

            case VK_KP_LEFT:
            case VK_KP_UP:
            case VK_KP_RIGHT:
            case VK_KP_DOWN:

            case VK_SCROLL_LOCK:
            case VK_CAPS_LOCK:
            case VK_NUM_LOCK:
            case VK_PAUSE:

            case VK_BEGIN:

            case VK_AGAIN:
            case VK_UNDO:
            case VK_COPY:
            case VK_PASTE:
            case VK_CUT:
            case VK_FIND:
            case VK_PROPS:
            case VK_STOP:

            case VK_FINAL:
            case VK_CONVERT:
            case VK_NONCONVERT:
            case VK_ACCEPT:
            case VK_MODECHANGE:
            case VK_KANA:
            case VK_KANJI:
            case VK_ALPHANUMERIC:
            case VK_KATAKANA:
            case VK_HIRAGANA:
            case VK_FULL_WIDTH:
            case VK_HALF_WIDTH:
            case VK_ROMAN_CHARACTERS:
            case VK_ALL_CANDIDATES:
            case VK_PREVIOUS_CANDIDATE:
            case VK_CODE_INPUT:
            case VK_JAPANESE_KATAKANA:
            case VK_JAPANESE_HIRAGANA:
            case VK_JAPANESE_ROMAN:
            case VK_KANA_LOCK:
            case VK_INPUT_METHOD_ON_OFF:
                return true;
        }

        return false;
    }

    public static KeyCode fromKeyCode(final int keyCode) {
        for (KeyCode kc : KeyCode.values()) {
            if (kc.keyCode == keyCode) {
                return kc;
            }
        }
        return KeyCode.VK_UNDEFINED;
    }

}
